package logic

import (
	"ViewSrv/global/model"
	"ViewSrv/internal/svc"
	"ViewSrv/view"
	"context"

	"github.com/zeromicro/go-zero/core/logx"
)

type VideoLikeLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewVideoLikeLogic(ctx context.Context, svcCtx *svc.ServiceContext) *VideoLikeLogic {
	return &VideoLikeLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *VideoLikeLogic) VideoLike(in *view.VideoLikeRequest) (*view.VideoLikeResponse, error) {
	// todo: add your logic here and delete this line
	var VideoLike = model.VideoLike{
		VideoId: int(in.VideoId),
		UserId:  int(in.UserId),
	}
	if err := model.DB.Create(&VideoLike).Error; err != nil {
		return nil, err
	}
	return &view.VideoLikeResponse{}, nil
}
